package com.ruoyi.miniapp.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.miniapp.api.RemoteMiniappUserService;
import com.ruoyi.miniapp.api.domain.MiniappUser;
import com.ruoyi.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteMiniappUserFallbackFactory implements FallbackFactory<RemoteMiniappUserService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteMiniappUserFallbackFactory.class);
    @Override
    public RemoteMiniappUserService create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteMiniappUserService() {
            @Override
            public R<LoginUser> info(String userName, String source) {
                return null;
            }

            @Override
            public R<Boolean> update(MiniappUser miniappUser, String source) {
                return null;
            }
        };
    }
}
